package interfazUsuario;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

import cultivameCore.entorno.Entorno;
import cultivameCore.motor.Refrescable;

@SuppressWarnings("serial")
public class PantallaPruebaNiveles extends JPanel implements Refrescable {	
	
	JScrollBar js=new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 100);
	JLabel monitorjs=new JLabel();
	Entorno entorno;
	
	public PantallaPruebaNiveles(Entorno _entorno){
		entorno=_entorno;
		
		setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(0), "hola",TitledBorder.CENTER , TitledBorder.DEFAULT_POSITION, new Font("SansSerif", Font.ITALIC, 10), Color.GREEN));
		
		setPreferredSize(new Dimension(400, 300));
		setMinimumSize(getPreferredSize());
		
		this.setLayout(new GridBagLayout());
		GridBagConstraints c=new GridBagConstraints();
		c.gridx=0;
		c.gridy=0;
		c.gridwidth=1;
		c.gridheight=1;
		c.weightx=1;
		c.weighty=1;
		c.anchor=GridBagConstraints.SOUTHEAST;
		c.fill=GridBagConstraints.NONE;
		c.insets=new Insets(0,0,0,5);
		
		add(new JButton(), c);
		
		c.gridx=0;
		c.gridy=1;
		c.gridwidth=1;
		c.gridheight=1;
		c.weightx=1;
		c.weighty=1;
		c.anchor=GridBagConstraints.EAST;
		c.fill=GridBagConstraints.NONE;
		c.insets=new Insets(0,0,0,5);
		
		add(new JButton(), c);
		
		c.gridx=0;
		c.gridy=2;
		c.gridwidth=1;
		c.gridheight=1;
		c.weightx=1;
		c.weighty=1;
		c.anchor=GridBagConstraints.NORTHEAST;
		c.fill=GridBagConstraints.NONE;
		c.insets=new Insets(0,0,0,5);
		
		add(new JButton(), c);
		
		c.gridx=0;
		c.gridy=3;
		c.gridwidth=1;
		c.gridheight=1;
		c.weightx=1;
		c.weighty=1;
		c.anchor=GridBagConstraints.CENTER;
		c.fill=GridBagConstraints.HORIZONTAL;
		c.insets=new Insets(5,0,0,5);
		
		js.setValue(Math.round(entorno.getHumedad()*100));
		add(js,c);
		
		c.gridx=0;
		c.gridy=4;
		c.gridwidth=1;
		c.gridheight=1;
		c.weightx=1;
		c.weighty=1;
		c.anchor=GridBagConstraints.CENTER;
		c.fill=GridBagConstraints.HORIZONTAL;
		c.insets=new Insets(5,0,0,5);
		
		monitorjs.setText(String.valueOf(js.getValue()));
		
		add(monitorjs,c);
	}

	@Override
	public void actualizar(int ms) {
		// TODO Auto-generated method stub
		js.setValue(Math.round(entorno.getHumedad()*100));
		monitorjs.setText(String.valueOf(js.getValue()));
	}
}
